// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    isPlayingMusic: false
  },
  bgm:null,
  music_url:'http://music.163.com/song?id=1412846583&userid=1473097404',
  music_coverImgUrl:'http://music.163.com/song?id=1412846583&userid=1473097404',
  onReady: function(){
    this.bgm = wx.getBackgroundAudioManager()
    this.bgm.title = 'marry me'
    this.bgm.epname = 'wedding'
    this.bgm.singer = 'singer'
    this.bgm.coverImgUrl = this.music_coverImgUrl
    this.bgm.onCanplay(() =>{
      this.bgm.pause()
    })
    this.bgm.src = this.music_url
  },
  play:function(e){
    if(this.data.isPlayingMusic){
      this.bgm.pause()
    }else{
      this.bgm.play()
    }
    this.setData({
      isPlayimgMusic: !this.data.isPlayimgMusic
    })
  },
  callGroom:function(){
    wx.makePhoneCall({
      phoneNumber: '1xxxxxxxx',
    })
  },
  callBride:function(){
    wx.makePhoneCall({
      phoneNumber: '2xxxxxxxx',
    })
  }
})